const express = require("express");
const { createProxyMiddleware } = require("http-proxy-middleware");

const app = express();

app.use(express.static("./client")); // 静态资源

app.use(
  "/api",
  createProxyMiddleware({
    target: "http://localhost:8000",
    pathRewrite: {
      "^/api": "",
    },
  })
);

app.listen(9000, () => {
  console.log("server is running on http://localhost:9000");
});
